// api http://10.20.9.32:40001/project/57/interface/api/9260
const FUNCTION_OPERATE = [
  {
    title: "运输方式与追踪号",
    options: [
      // batchMultiChannelShip

      // { label: "批量申请全额退款", fn: "onApplyRefund", isPer: "batchApplyRefund" },
      { label: "亚马逊多渠道发货", fn: "onMultiChannelShip", isPer: "batchMultiChannelShip" },
      { label: "批量亚马逊多渠道发货", fn: "onMultiChannelShipBatch", isPer: "batchMultiChannelShipBatch" },
      { label: "批量执行订单策略", fn: "orderStrategy", isPer: "batchStrategy" },
      { label: "批量修改发货仓库和运输方式", fn: "editShippingMethod", isPer: "batchEdit" },
      { label: "批量手动预生成追踪号", fn: "generateTrackingNo", isPer: "batchGenerate" },
      { label: "批量手动导入追踪号", fn: "manuallyImportTrackingNo", isPer: "batchImport" },
      { label: "批量手动上传追踪号", fn: "manuallyImportTrackingNo1", isPer: "batchImportTraceNumber" },
      { label: "批量上传二手机维修编号", fn: "onSkuRepairNumber", isPer: "batchSkuRepairNumber" },
      { label: "批量获取回邮单号", fn: "onReturnTracking", isPer: "batchReturnTrackingNum" },
      // { label: '批量取消追踪号', fn: 'cancelTrackingNo' },
    ],
  },
  {
    title: "发货与标发",
    options: [
      { label: "批量设置订单已发货", fn: "orderShipped", isPer: "batchShipped" },
      { label: "批量手动标发订单", fn: "orderForShipment", isPer: "batchPublish" },
      { label: "批量设置不标发", fn: "notToPublish", isPer: "batchNot" },
      { label: "批量重新上传追踪号到平台", fn: "reUploadTrackingNo", isPer: "batchUpload" },
      { label: "批量手动同步海外仓发货", fn: "syncOverseasWarehouse", isPer: "batchSync" },
      { label: "批量上传海外仓出库单号", fn: "onOutNumber", isPer: "batchOutNumber" },
      // { label: '同步订单到FBA发货（亚马逊）', fn: 'syncFBA' },
      // { label: "批量标记物流退回", fn: "onBatchRemark", isPer: "shippedReturnRemark" },
    ],
  },
  {
    title: "人员与备注信息",
    options: [
      { label: "批量修改客服人员", fn: "editCustomer", isPer: "batchCustomer" },
      { label: "批量修改销售人员", fn: "editSeller", isPer: "batchSeller" },
      { label: "批量修改订单备注", fn: "editRemark1", isPer: "batchRemark1" },
      { label: "批量修改订单发货备注", fn: "editRemark3", isPer: "batchRemark3" },
      { label: "批量修改客服备注", fn: "editRemark4", isPer: "batchRemark4" },
      { label: "批量修改物流备注", fn: "editRemark5", isPer: "batchRemark4" },
    ],
  },
]

import api from "../../api"
const confirm = {
  shipmentInterception: {
    title: "库内拦截(未发货)",
    tips: "仓库发货前，可通知仓库拦截订单！\n本地仓库发货的订单，可立即拦截；海外仓发货的订单，需等待海外仓反馈是否拦截成功。",
    inputLabel: "订单备注",
  },
  blacklist: {
    title: "添加黑名单",
    inputLabel: "拉黑理由",
  },

  // -------- 以下用新组建 ---------
  customer: {
    title: "批量修改客服人员",
    api: api.batchOperation,
    length: 0,
    fieldOptions: [
      {
        field: "customer_id",
        type: "cascader",
        label: "新客服人员",
        itemProps: { placeholder: "新客服人员", multiple: false },
        style: { width: "100%" },
      },
      {
        field: "remark",
        label: "订单备注",
        placeholder: "订单备注",
        type: "textarea",
        style: { width: "100%" },
        autosize: { minRows: 4, maxRows: 6 },
      },
    ],
    rules: {
      customer_id: [{ required: true, message: "请选择", trigger: "change" }],
      remark: [{ required: true, message: "请输入", trigger: "blur" }],
    },
  },

  seller: {
    title: "批量修改销售人员",
    api: api.batchOperation,
    length: 0,
    fieldOptions: [
      {
        field: "source_sale_id",
        label: "原销售人员",
        type: "cascader",
        itemProps: { placeholder: "原销售人员", multiple: false },
        style: { width: "100%" },
      },
      {
        field: "target_sale_id",
        label: "新销售人员",
        type: "cascader",
        itemProps: { placeholder: "新销售人员", multiple: false },
        style: { width: "100%" },
      },
    ],
    rules: {
      source_sale_id: [{ required: true, message: "请选择", trigger: "change" }],
      target_sale_id: [{ required: true, message: "请选择", trigger: "change" }],
    },
  },
  // 订单备注
  order_remark: {
    title: "订单备注",
    api: api.batchRemarkOrder,
    length: 0,
    fieldOptions: [
      {
        field: "is_append",
        label: "操作类型",
        type: "select",
        placeholder: "操作类型",
        options: {
          placeholder: "操作类型",
          data: [
            { label: "修改", value: 0 },
            { label: "追加", value: 1 },
          ],
        },
        style: { width: "100%" },
      },
      {
        field: "remark",
        label: "订单备注",
        placeholder: "订单备注",
        type: "textarea",
        style: { width: "100%" },
        autosize: { minRows: 4, maxRows: 6 },
      },
    ],
    rules: {
      source_sale_id: [{ required: true, message: "请选择", trigger: "change" }],
      remark: [{ required: true, message: "请输入", trigger: "blur" }],
    },
  },

  /* ------- 订单操作 ------- */
  // 批量取消系统订单
  cancel: {
    title: "批量取消系统订单",
    api: api.batchCancel,
    length: 0,
    fieldOptions: [
      {
        field: "order_cancel_reason",
        label: "取消原因",
        type: "select",
        origin: "order_cancel_reason",
        options: {
          placeholder: "取消原因",
          data: [
            { label: "修改", value: 0 },
            { label: "追加", value: 1 },
          ],
        },
        style: { width: "100%" },
      },
      {
        field: "remark",
        label: "取消备注",
        placeholder: "取消备注",
        type: "textarea",
        style: { width: "100%" },
        autosize: { minRows: 4, maxRows: 6 },
      },
    ],
    tips: "说明：未发货的订单系统可以取消，但已发货的订单系统不允许取消！",
    rules: {
      order_cancel_reason: [{ required: true, message: "请选择", trigger: "change" }],
      remark: [{ required: true, message: "请输入", trigger: "blur" }],
    },
  },

  // 批量取消 ebay订单
  ebay_cancel: {
    title: "批量取消eBay订单",
    api: api.batchOperation,
    // api: api.batchEbayCancel,
    length: 0,
    fieldOptions: [
      {
        field: "reason",
        label: "取消原因",
        type: "select",
        origin: "ebay_order_cancel_reason",
        options: {
          placeholder: "取消原因",
        },
        style: { width: "100%" },
      },
    ],
    tips: `<span>
            仅支持eBay平台订单操作，<span class="text-[#FF0000]">
              建议选择【买家原因】，此原因对账号信用无影响！
            </span>
          </span>`,
    rules: {
      reason: [{ required: true, message: "请选择", trigger: "change" }],
    },
  },

  // 编辑 收件地址
  recipientAddress: {
    title: "收件地址",
    width: "1200",
    api: api.orderUpdateRecipient,
    formOptions: { inline: true },
    form: {},
    fieldOptions: [
      { field: "buyer_name", label: "买家姓名", style: { width: "200px" }, disabled: true },
      { field: "recipient_name", label: "收件人名", style: { width: "200px" } },
      { field: "recipient_last_name", label: "收件人姓", style: { width: "200px" } },
      { field: "recipient_company", label: "公司名称", style: { width: "200px" } },
      { field: "recipient_phone", label: "联系电话", style: { width: "200px" } },
      { field: "recipient_email", label: "邮箱", style: { width: "300px" } },
      { field: "recipient_tax_id", label: "收件人证件/税号", style: { width: "300px" } },
      {
        field: "recipient_country",
        label: "国家/地区",
        type: "select",
        options: { valueKey: "country", labelKey: "name" },
        style: { width: "200px" },
        originField: "countryOpt",
      },
      { field: "recipient_province", label: "州/省", style: { width: "200px" } },
      { field: "recipient_city", label: "城市", style: { width: "200px" } },
      { field: "recipient_region", label: "区/县", style: { width: "200px" } },
      { field: "recipient_zip_code", label: "邮编", style: { width: "300px" } },
      { field: "recipient_door_num", label: "门牌号", style: { width: "300px" } },
      { field: "recipient_preferred_address", label: "详细地址", itemStyle: { width: "100%" }, style: { width: "100%" }, full: true },
      { field: "recipient_secondary_address", label: "详细地址2", itemStyle: { width: "100%" }, style: { width: "100%" }, full: true },
    ],
    rules: {
      // buyer_name: [{ required: true, message: "请输入买家姓名", trigger: "blur" }],
      recipient_name: [{ required: true, message: "请输入收件人名", trigger: "blur" }],
      recipient_last_name: [{ required: true, message: "请输入收件人姓", trigger: "blur" }],
      recipient_phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
      recipient_country: [{ required: true, message: "请选择国家地区", trigger: "blur" }],
      recipient_zip_code: [{ required: true, message: "请输入邮编", trigger: "blur" }],
      recipient_preferred_address: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
    },
  },
}

export { FUNCTION_OPERATE, confirm }
